package com.eas.task.common.job;

import java.util.UUID;

import com.eas.task.common.interfaces.EasTaskJob;

public class TaskJobWrapper implements Runnable {

    private String uuid;

    private String id;

    private String info;

    private JobStatus status;

    private EasTaskJob job;

    public TaskJobWrapper(EasTaskJob job) {
        this.job = job;
        this.uuid = UUID.randomUUID().toString();
        this.status = JobStatus.WAITING;
    }

    @Override
    public void run() {
        status = JobStatus.RUNNING;
        if (job != null) {
            job.work();
        }
        status = JobStatus.FINISHED;
    }

    public String getUuid() {
        return uuid;
    }

    public EasTaskJob getJob() {
        return job;
    }

    public JobStatus getStatus() {
        return status;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

}
